package com.xiaoyun.controller;

import com.xiaoyun.pojo.Stu;
import com.xiaoyun.service.StuService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequiredArgsConstructor
public class StuFooController {

    private final StuService stuService;


    @GetMapping("getStu")
    public Stu hello(Integer id) {
        return stuService.getStuInfo(id);
    }

    @PostMapping("saveStu")
    public Object saveStu() {
        stuService.saveStu();
        return "OK";
    }

    @PostMapping("updateStu")
    public Object updateStu(Integer id) {
        stuService.updateSut(id);
        return "OK";
    }

    @PostMapping("deleteStu")
    public Object deleteStu(Integer id) {
        stuService.deleteStu(id);
        return "OK";
    }
}
